<template>
    <div class="title">
        🆕🍍💥💚⚡️⤵️🧩🔥商城
    </div>
    <form action="/">
        <van-search v-model="value" show-action placeholder="请输入搜索关键词" @search="onSearch" @cancel="onCancel" />
    </form>
</template>

<script lang="ts" setup>
import { ref, type Ref } from 'vue';
import { useRouter } from 'vue-router';


const router = useRouter()
const value: Ref<any> = ref('')
const onSearch = (val: any) => {
    if (val) {
        router.push(
            {
                path: '/search',
                query: {
                    type: val
                }
            }
        )
    } else {
        return
    }
}
const onCancel = () => {

}


</script>

<style lang="scss" scoped>
.title {
    line-height: 30px;
    font-size: 20px;
    font-weight: bold;
    font-family: cursive;
    text-align: center;
    color: #e9c93a;
}
</style>